﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RolesList.aspx.cs" Inherits="ModulesToolkit.Membership.Views.RolesList"
    Title="RolesList" MasterPageFile="~/Shared/DefaultMaster.master" %>

<asp:Content ID="content" ContentPlaceHolderID="uxDefaultContentPlaceHolder" runat="Server">
    <h1>
        Roles List</h1>
    <div class="entryForm">
        <div>
            <asp:Label runat="server" ID="uxNameCaption" Text="Role" AssociatedControlID="uxName"></asp:Label>
            <asp:TextBox runat="server" ID="uxName"></asp:TextBox>
            <asp:Button runat="server" ID="uxSearch" Text="Search" OnClick="uxSearch_Click" />
        </div>
    </div>
    <div style="text-align: right; width: 500px">
        <asp:Button runat="server" ID="uxAdd" Text="Add" OnClick="uxAdd_Click" />
    </div>
    <br />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="uxSearch" />
        </Triggers>
        <ContentTemplate>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="true">
                <ProgressTemplate>
                    <div style="padding: 5px; padding-left: 20px; float: left">
                        <img alt="loading" src="../Images/ajax-loader1.gif" />
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>
            <div class="GridContainer" style="width: 500px;">
                <asp:GridView runat="server" ID="uxRolesList" DataSourceID="uxRolesListSource" OnRowCommand="uxRolesList_RowCommand">
                    <Columns>
                        <asp:TemplateField HeaderText="Name" SortExpression="Name">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("Name") %>' CommandName="Editing"
                                    CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="LastUpdatedby" HeaderText="Updated by" SortExpression="LastUpdatedby" />
                        <asp:BoundField DataField="LastUpdatedDate" HeaderText="Last Updated" DataFormatString="{0:d}"
                            SortExpression="LastUpdatedDate" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:ImageButton ID="uxDeleteButton" runat="server" CommandName="Deleting" ImageUrl="~/Images/Delete16.png"
                                    CommandArgument='<%# Eval("Id") %>' />
                                <ajax:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="uxDeleteButton"
                                    ConfirmText="<%$ Resources:Confirmation, 0001 %>">
                                </ajax:ConfirmButtonExtender>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <asp:Literal ID="Literal1" runat="server" Text='<%$ Resources:Content, 0001 %>'></asp:Literal>
                    </EmptyDataTemplate>
                </asp:GridView>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <WCSF:ObjectContainerDataSource runat="server" ID="uxRolesListSource" UsingServerPaging="true"
        UsingServerSorting="true" OnSelecting="uxRolesList_Selecting" />
        
    <asp:UpdatePanel runat="server" ID="uxPopupUpdatePanel" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="uxAdd" />
        </Triggers>
        <ContentTemplate>
            <mtl:Popup runat="server" ID="uxRolesDetails" IsModel="true" Width="550px" CloseImageUrl="~/Images/close.png"
                Height="450px" Title="Role Details" CausesValidation="false">
                <ContentTemplate>
                    <div class="infoPanel">
                        <asp:Literal ID="Literal2" runat="server" Text='<%$ Resources:Content,0002 %>'></asp:Literal>
                    </div>
                    <table class="entryForm">
                        <tr>
                            <td>
                                <asp:Label ID="Label1" runat="server" Text="Name" AssociatedControlID="uxNameField">
                                </asp:Label>
                                *
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="uxNameField">
                                </asp:TextBox>
                                <asp:RequiredFieldValidator ID="uxNameFieldRequiredValidator" runat="server" Display="Dynamic"
                                    ControlToValidate="uxNameField" ValidationGroup="roleDetails" ErrorMessage="<%$Resources:Error, 0001 %>">
                                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/warning.png" Style="vertical-align: middle" />
                                </asp:RequiredFieldValidator>
                                <asp:CustomValidator runat="server" ID="uxNameFieldDublicationValidator" Display="Dynamic"
                                    ControlToValidate="uxNameField" ValidationGroup="roleDetails" ErrorMessage="<%$ Resources:Error, 0003 %>"
                                    OnServerValidate="uxNameFieldDublicationValidator_ServerValidate">
                                    <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/warning.png" Style="vertical-align: middle" />
                                </asp:CustomValidator>
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">
                                <asp:Label ID="uxDescriptionCaption" runat="server" Text="Description" AssociatedControlID="uxDescriptionField">
                                </asp:Label>
                                *
                            </td>
                            <td>
                                <asp:TextBox runat="server" ID="uxDescriptionField" TextMode="MultiLine">
                                </asp:TextBox>
                            </td>
                        </tr>
                    </table>
             
                    <ajax:Accordion runat="server" ID="uxScreensAccordion" FadeTransitions="true" OnItemDataBound="uxScreenRightsBinding" >
                        <HeaderTemplate>
                            <div with="100%" style="background:white;">
                                <h2>
                                <%# Eval("Name") %>
                                </h2>
                            </div>
                        </HeaderTemplate>
                        <ContentTemplate>
                            <div with="100%" style="background:yellow;">
                            <%--<h3>--%>
                 <asp:GridView runat="server" ID="uxScreensRights" DataSourceID="uxSreensRights_DataSource">
                              <Columns>
                             <asp:TemplateField HeaderText="Name" SortExpression="Name">
                              <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" Text='<%# Eval("Name") %>'
                                    CommandArgument='<%# Eval("Id") %>'></asp:LinkButton>
                            </ItemTemplate>
                          </asp:TemplateField>
                          </Columns>
                        </asp:GridView>
                       <%-- </h3>--%>
                            </div>
                        </ContentTemplate>
                    </ajax:Accordion>
                </ContentTemplate>
            </mtl:Popup>
        </ContentTemplate>
    </asp:UpdatePanel> 
</asp:Content>
